<style lang="scss" scoped>
  // @import '@/assets/css/variable';
  .item{
	  
	  // &:nth-child(even){
	  // 	margin-right: 0px;
	  // }
	  img{
	  	object-fit: cover;
		width: 100%;
	  	height:100px;
		border-radius: 8px;
		overflow: hidden;
	  }
  }
</style>
<template>
  <div
    class="item flex flex-column padding-all-m"
    @click="toDetailView(objItem)"
  >
    <img :src="objItem.main_img" alt="">
    <div class="fs-15 ellipsis-line1 margT-l color-ll text-justify">{{ objItem.title }}</div>
	<div class="fs-14 margT-m flex justify-end color-l" @click.stop="addZanBtn(objItem)">
		<i class="iconfont iconfont-active-goods"></i>
		<span class="margL-s">{{objItem.zan_num||0}}</span>
	</div>
  </div>
</template>
<script>
import {
	myMixins
} from "@/assets/js/mixins.js"
export default {
  mixins: [myMixins],
  components: {
  },
  props: {
    item: {
      type:Object,
      default(){
      	return {}
      }
    },
  },
  data() {
    return {
      objItem: ''
    };
  },
  mounted() {
	this.objItem = this.item
    // const navbarHeight = this.$refs.navbar.offsetHeight
    // console.log('navbarHeight',navbarHeight)
    // this.$store.commit('setNavbarHeight',navbarHeight)
  },
  methods: {
	addZanBtn(obj) {
	  console.log('addZanBtn',obj)
	  this.$request.newsAddZan({id:obj.id}).then(res=>{
		  if(res.code == this.$utils.getCode()){
			  this.objItem.zan_num++
		  }
	  })
	},
    toDetailView(record) {
      this.$emit('toDetailView',record)
    },
    onClickRight() {
      this.$router.push('/workbench')
    },
  },
};
</script>
